Added linked list for the devices and rules
Added a bunch of comments
Refined some methods
TODO: Finish adding comments
work on the rules linked list