Recoded core, not working properly