Wrote a more efficient method to compress methods