Added several comments, increased versatility and proficiency.