code refactoring. the application is working now! =))