improving and testing main class