taken from Tympanus and optimized for myself..