Revision2

Exact copy from server with new fixes. Rather work on localhost.