Updated for WordPress v4.0 and sorted some PHP bugs