This commit is an attempt to make everything a bit more object oriented.