Refactored the whole application.