reduced and optimized code