added debug mode and costings