Now using correct buffer length when sending 404
Some refactoring
Added empty to index.html redirect, and some cleanup