Started to work on front-end.

Also fixed some pass by reference/value problems.