compile function modified