Update to version 2.0.4, fixes bugs and cleans up implementation