Final Working Implementation