A bug caused the app to freeze. Fixed + refactored