adding data handling, untrending and some constants