working version no inheritance