Finally did it I think, now to implement