Merged with Lincoln's Code
Minor modifications