v1 completed. Needs some minor tweaks