Implemented first come first served algorithm