Updated with Comments and fixed a couple bugs