fixed script
refactored the starting of the app