moved prototype implamentation to compile phase and added closure for protected object that is passed into prototype functions