Optimize + test cases