Tried to implement some of the things you suggested in comments..