Created proof of concept. This is not beatiful, more like a psuedo code.