Updating master branch

Working but, kinda unstable, need re-factoring.