Finished refactoring. Next: add jquery