Simplified some piece of code