Based on Kohana 3.2