restructure of coding. Created helper classes