still doesnt compile, code per discussion with Kamran