use inclass function and make it perfect