initial commit with weird code

yep, very weird, messy and undocumented code. but what the heck.