Updated module code so now it works a lot better