Adjusted code to follow code conventions

also added references