Added LinkedList datastructure and other code refactoring