some changes to header and functions