[#970] Clean up code