Add optimize for private and public methods