Code improvements according to feedback