Added research system
minor optimizations