fix for page load issue and minor refactoring