Refactor some duplicate code and make site mobile friendly