Cleanup variables.
Implement "--mode" switch to tell what we want to build.
Fix functions definition
Fix syntax errors
Merge pull request #229 from Alexpux/develop

Implement "--mode" switch