corrected code for app to be scalable