added all necessary routines