improve solution for Autumn 2013 exam