Add forum login, some refactoring