Fix warnings and errors, rename constants
Break up repository.cpp into multiple smaller units
Implement streams properly, error handling, clean-up everything, add build.py scripts