just a few refactors and simplified the short version to be optimal