optimized if statement check in push method