added spinner, error message and refactoring