Minor code optimalizations