Fixes and closes #14 by using apply and POSIXct and ifelse