More bug fixes, now compiles