Updated code to use abstract stuff - in progress