Simplify the code + testing