Cleaned up the core file

Changed functions, removed as many intervals as possible and replaced
functions