Fixed various logical and syntax errors that prevented
the application from running smoothly