big refactoring fixing conventions and added new tests as well