Added and cleaned up implementation