Added tests and fixed code-style