error handling
Better js validation