Cleaned code and fixed release event

[Fixed] Page would not release under certain circumstances
[Fixed] Tiny bugs, lots of cleaning