Updated and refactored the whole application