Hardest bit is actually not the level generation. That part is well documented in the original source code.
Performing all the collision checks between player/enemies/backgrounds/items/traps without overloading the CPU was actually the hardest part.