fixed extending (still needs to be cleaned up and needs unit tests!)