major code changes, better build system