Inspired by and partially adpated from Sparkle Button