some code formating, added new tests