added annotations and code commends. cleaned up code