first version of code that might actually compile on ubuntu 12