refactoring + tests

Added some tests, extracted some classes from page model, some refactoring and code improvements.