added procedures functionality, cleaned up bugs left over from last build