restructured the application with  better code