Initial full implementation of wall functions. Needs debugging...