fixed broken variable - added duration feature

using this in an upcoming project. fixed issue and added a single duration capability feature that made it a simpler usage for my project without taking away any functionality from the previous implementation