Finished core part of the functionality.