Major bug fixes

Improved compatibility with other servers, location is found by using
built in functions, exports can be dealt with at the top of each
document using them