Working on top. Refactored JS