Optimize methods and update test