added comments for some dirty code