Initial commit with original (slightly fixed up) code