Added bulk of code for version 0.1