Initial commit, reasonable functionality but no optimisations