Modified for Kohana 3.3