gave into jquery, refactored