First commit. Badly written code but partially works.