Fixed and tweaked main layout

![kss bazuka zaloguj si](https://cloud.githubusercontent.com/assets/1470018/3038962/08bc41c2-e0d5-11e3-8d9f-aa70edefb094.png)

Also written some tests

[#239]