First upload of actual code, still buggy and incomplete.