initial dump of somewhat working code :p