refactoring app; this commit is a saving point