removed unused code and fixed inheritance bug