Simplified some code