general working app

needs tlc, some magic numbers, hardcoded stuff, and no
comments............