Added check if query is defined.
Changed method for getting url and query to strstr.
Added check to detect empty query url.
Assign params and query to empty arrays in case they have no value.
Added handling for errors and fatal errors.
Added basic impelementation of template layer.