Updated to work properly

Things now print in correct order