many, many bug fixes. also added basis of future buid system