Made checkout code even worse.

add checkin and recheckout functionality