add package level environment, update setup files on prefix level accordingly
convert some macros to functions