commenting almost done.... added some error handling