improved const function support
made the generate..endgenrate keywords optional
further improved const function support