Fixes and refactoring

Major refactoring
Start preparing app to use dynamic content.
Static analysis.